<template>
  <div class="container-big profile-page wing-blank">
    <!-- <div class="alibaba-design" /> -->
    <!-- <div class="uncan-2019-text" /> -->
    <!-- <div class="uncan-right" /> -->
    <co-list margin>
      <co-list-item class="pointer" link to="/profile/order-list">
        <span>我的订单</span>
      </co-list-item>
      <!-- v-if="showinvoiceList" -->
      <co-list-item class="pointer" link to="/invoiceList">
        <span>我的发票</span>
      </co-list-item>
      <!-- <co-list-item class="pointer" link to="/profile/address">
        <span>我的地址</span>
      </co-list-item> -->
      <co-list-item class="pointer" link to="/profile/company">
        <span>公司信息</span>
      </co-list-item>
      <co-list-item class="pointer" link to="/profile/user-list">
        <span>用票人信息</span>
      </co-list-item>
      <co-list-item @click="customerServiceTel()" v-if="ifShowPhone" class="pointer" link>
        <span>联系客服</span>
      </co-list-item>
      <co-list-item class="pointer" link to="/profile/setUp">
        <span>设置</span>
      </co-list-item>
      <!-- <co-list-item link to="/help/faq">
        <span>Q&A</span>
      </co-list-item> -->
    </co-list>
  </div>
</template>

<script>
import { jwtFun } from "@/router/publicJs/jwt";
export default {
  name: "Profile",
  data() {
    return {
      showinvoiceList: false,
      ifShowPhone: ""
    };
  },
  created() {
    this.ifShowPhone =
      sessionStorage.getItem("customerServiceTel") ||
      sessionStorage.getItem("connectEmail");
    this.getThisPhone();
  },
  methods: {
    // 获取当前登录人手机号,测试阶段部分人可见
    async getThisPhone() {
      this.showinvoiceList = false;
      const thisPhone = (await jwtFun()).linkphone;
      let zhuansongList = [
        "15972961091",
        "13758141708",
        "15868154582",
        "13127882837",
        "18621532154",
        "17623878198",
        "15855431282",
        "1760130268995005"
      ];
      if (zhuansongList.indexOf(thisPhone) != -1) {
        this.showinvoiceList = true;
      }
    },
    async customerServiceTel() {
      let value = "";
      if (sessionStorage.getItem("customerServiceTel")) {
        value = `客服电话:${sessionStorage.getItem("customerServiceTel")}`;
      }
      if (sessionStorage.getItem("connectEmail")) {
        value += `     客服邮箱:${sessionStorage.getItem("connectEmail")}`;
      }
      await this.$confirm(value, {
        title: "联系客服",
        okLabel: "知道了",
        showCancel: false
      });
    }
  }
};
</script>

<style lang="less">
.profile-page {
  padding-top: 196px;
}
.pointer {
  cursor: pointer;
}
</style>
